package com.atguigu.day02;

import org.apache.flink.shaded.guava18.com.google.common.primitives.Bytes;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

import java.util.Arrays;
import java.util.List;

public class Flink02_Source_Collcetion {
    public static void main(String[] args) throws Exception {
        //1.获取流的执行环境
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);

        //2.从集合获取数据

        //创建集合
//        List<Integer> list = Arrays.asList(1, 2, 3, 4, 5);

//        DataStreamSource<Integer> streamSource = env.fromCollection(list).setParallelism(2);
        //多并行度方法
//        env.fromParallelCollection()


        //从元素中获取数据
        DataStreamSource<Integer> streamSource = env.fromElements(1, 2, 3, 4, 5).setParallelism(2);


        streamSource.print();

        env.execute();

    }
}
